Page({
  data: {
    showUrl: "",
    canUse: true,
  },
  onLoad({platform}) {
    let app = getApp()
    app.setShareChannel(platform)
    // 全免押金租手机
    let time = new Date().getTime()
    this.data.showUrl = `https://www.ddzuji.cn/topic/alipay/h5/freeDeposit/index.html?id=${time}`;
  },
  onMessage(e) {
    e.detail.action && this.onSubscribeMessage()

    console.log(e);
  },
  // 订阅消息
  onSubscribeMessage() {
    my.requestSubscribeMessage({
      entityIds: [
        'b0c7589d65dd4352922e1b6016f0a78d',
        '1ad56d038bfe4bfabe91db8dfd703ce5',
        '366afcf17f424cf0b8d67a93493bae7a'
      ],
      success: () => {
        my.switchTab({
          url: '/page/rent/sorts/sorts'
        })
      },
      fail: err => {
        // 成功和失败与否都跳转分类页
        my.switchTab({
          url: '/page/rent/sorts/sorts'
        })
      }
    })
  } 
});
